<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="style/css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="style/js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="style/js/fun.js"></script>
</head>

<body>
<span class="subTitle">计算数组中元素个数</span>
<?php
	$array = array("zero","one","two","three","four","five");
	$len = count($array);
	
	echo "完整输出数组: ";
	print_r(array_count_values($array));
	echo "<br />元素个数为: ".$len;
?>
<span class="subTitle">对数组排序及逆向排序</span>
<?php
	$array_1 = array("1","3","5","4","7","2","6");
	echo "数组的原始顺序为: ";
	
	for($i = 0; $i < count($array_1); $i++){
		echo $array_1[$i]." ";
	}
	
	sort($array_1);
	echo "<br />数组经过<strong><em> sort </em></strong>函数排序后: ";
	for($i = 0; $i < count($array_1); $i++){
		echo $array_1[$i]." ";
	}
	
	rsort($array_1);
	echo "<br />数组经过<strong><em> rsort </em></strong>函数排序后: ";
	for($i = 0; $i < count($array_1); $i++){
		echo $array_1[$i]." ";
	}
	
	//带有数字和字符的数组
	$array_2 = array("大连","1","china","8","Fighting");
	echo "<br /><br />数组的原始顺序为: ";
	
	for($i = 0; $i < count($array_2); $i++){
		echo $array_2[$i]." ";
	}
	
	sort($array_2);
	echo "<br />数组经过<strong><em> sort </em></strong>函数排序后: ";
	for($i = 0; $i < count($array_2); $i++){
		echo $array_2[$i]." ";
	}
	
	rsort($array_2);
	echo "<br />数组经过<strong><em> rsort </em></strong>函数排序后: ";
	for($i = 0; $i < count($array_2); $i++){
		echo $array_2[$i]." ";
	}
	
	//全是汉字的数组
	$array_3 = array("大连","北京","阿根廷","南通","大理");
	echo "<br /><br />数组的原始顺序为: ";
	
	for($i = 0; $i < count($array_3); $i++){
		echo $array_3[$i]." ";
	}
	
	sort($array_3);
	echo "<br />数组经过<strong><em> sort </em></strong>函数排序后: ";
	for($i = 0; $i < count($array_3); $i++){
		echo $array_3[$i]." ";
	}
	
	rsort($array_3);
	echo "<br />数组经过<strong><em> rsort </em></strong>函数排序后: ";
	for($i = 0; $i < count($array_3); $i++){
		echo $array_3[$i]." ";
	}
?>
</body>
</html>